<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/4/15
 * Time: 10:08
 */

namespace App\Console\Commands;

use Illuminate\Console\Command;
use HiCommon\Service\AutoScheduleService;
use HiCommon\Service\LogService;


class ActivesAutoCancel extends Command
{
    protected $name = 'actives_auto_cancel';//30分钟未支付的商城订单自动取消

    protected $description = '略略略'; // 命令描述，没什么用

    /**
     * 30分钟未支付积分商城订单自动取消
     *
     * @throws \Exception
     * @author yang
     */
    public function handle()
    {
        try {
            shiwu_start();
            $res = AutoScheduleService::api_activity_auto_cancel();
            shiwu_end($res);
            if($res['state'] != 0){
                LogService::wright_log_for_auto_schedule('每分钟检测活动是否到期',$res,'error');
            }
        } catch (\Exception $exception) {
            $res = ['state' => 1, 'msg' => '失败', 'data' => [], 'error' => $exception->getMessage()];
            LogService::wright_log_for_auto_schedule('每分钟检测活动是否到期',$res,'error');

        }

    }


}